package example.file;

import java.io.File;

/**
 * Created by lenovo on 2016/11/4 0004.
 * file.createTempFile() 方法在指定目录中创建文件
 */
public class CreateFileInPath {
    public static void main(String[] args)
            throws Exception {
        File file = null;
        File dir = new File("D:/");//win10 下不能用C盘，会异常
        file = File.createTempFile("JavaTemp", ".java", dir);
        System.out.println(file.getPath());
    }
}
